import request from '@/utils/request'

// 创建故障类型
export function createFaultType(data) {
  return request({
    url: '/devices/fault-type/create',
    method: 'post',
    data: data
  })
}

// 更新故障类型
export function updateFaultType(data) {
  return request({
    url: '/devices/fault-type/update',
    method: 'put',
    data: data
  })
}

// 删除故障类型
export function deleteFaultType(id) {
  return request({
    url: '/devices/fault-type/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除故障类型 */
export function deleteFaultTypeList(ids) {
  return request({
    url: `/devices/fault-type/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得故障类型
export function getFaultType(id) {
  return request({
    url: '/devices/fault-type/get?id=' + id,
    method: 'get'
  })
}

// 获得故障类型分页
export function getFaultTypePage(params) {
  return request({
    url: '/devices/fault-type/page',
    method: 'get',
    params
  })
}
// 导出故障类型 Excel
export function exportFaultTypeExcel(params) {
  return request({
    url: '/devices/fault-type/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}